/*************************************************************************
	> File Name: oj-569_liquid_volume.cpp
	> Author: Wang Bo
	> Mail: 1276106221@qq.com
	> Created Time: 2020年11月04日 星期三 23时10分36秒
 ************************************************************************/

#include <iostream>
#include <cstdio>
#include <stack>
#include <vector>
using namespace std;

typedef pair<int, double> solution;
typedef stack<solution> operation;
typedef vector<pair<int, double>> dvec;

solution add_sol(const int &x, const double &y, const int &xx, const double &yy) {
    double origin_mass = (double) x * y / 100;
    double added_mass = (double) xx * yy / 100;
    int cur_volume = x + xx;
    double cur_con = (added_mass + origin_mass) / cur_volume * 100;
    return {cur_volume, cur_con};
}

solution remove_sol(const int &x, const double &y, const int &xx, const double &yy) {
    //cout << x << " " << y << " " << xx << " " << yy << endl;
    double added_mass = (double) xx * yy / 100;
    //cout << "added_mass: " << added_mass;
    double cur_mass = (double) x * y / 100;
    //cout << " cur_mass: " << cur_mass << endl;
    int last_volume = x - xx;
    //cout << "last vol: " << last_volume << endl;
    double last_con =  (cur_mass - added_mass) / last_volume * 100;
    //cout << "last con: " << last_con << endl;
    return {last_volume, last_con};
}

int main() {
    int v, c, n;
    char oper;
    solution magic;
    operation oper_stack;
    dvec sol_history;
    //scanf("%d%d", &magic.first, &magic.second);
    cin >> magic.first >> magic.second >> n;
    //scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        //scanf("%c", &oper);
        cin >> oper;
        if (oper == 'P') {
            //scanf("%d%d", &v, &c);
            cin >> v >> c;
            //处理溶液
            oper_stack.push(solution(v, c));
            magic = add_sol(magic.first, magic.second, v, c);
            sol_history.push_back({magic.first, magic.second});
            //cout << "history recorded: " << magic.first << " " << magic.second << endl;
        } else if (oper == 'Z'){
            //撤销操作
            if (!oper_stack.empty()) {
                magic = remove_sol(magic.first, magic.second, oper_stack.top().first, oper_stack.top().second);
                oper_stack.pop();
            }
            sol_history.push_back({magic.first, magic.second});
            //cout << "history recorded: " << magic.first << " " << magic.second << endl;
        }
    }
    for (auto i : sol_history) {
        printf("%d %.5f\n", i.first, i.second);
    }
    return 0;
}
